package main

import (
	"fmt"
	"strconv"
)

//string转换基本类型
func main() {

	var str string = "true"
	var b bool
	b, _ = strconv.ParseBool(str)
	fmt.Printf("str type %T str=%v \r\n", b, b)

	str = "12356"
	parseInt, _ := strconv.ParseInt(str, 10, 64)
	fmt.Printf("str type %T str=%v \r\n", parseInt, parseInt)

	str = "31.14"
	float, _ := strconv.ParseFloat(str, 64)
	fmt.Printf("str type %T str=%v \r\n", float, float)

}
